package com.itheima.health.pojo;

import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.annotation.Generated;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 角色
 */
@Table(name = "t_role")
@Data
public class Role implements Serializable {
    @Id
    @GeneratedValue(generator = "JDBC",strategy = GenerationType.IDENTITY)
    private Integer id;
    @Column(name = "name")
    private String name; // 角色名称
    @Column(name = "keyword")
    private String keyword; // 角色关键字，用于权限控制
    @Column(name = "description")
    private String description; // 描述

    private Set<User> users = new HashSet<User>(0);
    private Set<Permission> permissions = new HashSet<Permission>(0);
    private LinkedHashSet<Menu> menus = new LinkedHashSet<Menu>(0);

    public Role() {
    }

    public Role(String name, String keyword) {
        this.name = name;
        this.keyword = keyword;
    }

}
